package cn.hpu.service.impl;

import java.util.List;
import java.util.Map;

import cn.hpu.dao.CompanyContactDAO;
import cn.hpu.po.CompanyContact;
import cn.hpu.service.CompanyContactService;

public class CompanyContactServiceImpl implements CompanyContactService {

	private CompanyContactDAO contactDAO;

	public CompanyContactDAO getContactDAO() {
		return contactDAO;
	}

	public void setContactDAO(CompanyContactDAO contactDAO) {
		this.contactDAO = contactDAO;
	}

	public List<CompanyContact> loadContacts(Integer beginIndex, Integer pageSize) {
		
		return contactDAO.getContacts(beginIndex , pageSize);
	}

	public void add(CompanyContact contact) {

		contactDAO.add(contact);
	}

	public Integer getRecordCount() {

		return contactDAO.getRecordCount();
	}

	public List<CompanyContact> loadContactsByProperties(
			Map<String, String> queryConditions, Integer beginIndex,
			Integer pageSize) {

		return contactDAO.getContactsByProperties(queryConditions , beginIndex, pageSize);
	}

	public List<CompanyContact> loadContactsByProperties(
			Map<String, String> queryConditions) {
		
		return contactDAO.getContactsByProperties(queryConditions);
	}

	public CompanyContact loadContactById(Integer id) {
		
		return contactDAO.getContactById(id);
	}

	public void update(CompanyContact contact) {
		
		contactDAO.update(contact);
	}

	public void delete(CompanyContact contact) {
		
		contactDAO.delete(contact);
	}

	public void deleteAll(CompanyContact[] contacts) {
		
		for(CompanyContact contact : contacts) {
			contactDAO.delete(contact);
		}
	}

	public List<CompanyContact> loadContactsByCustomerId(Integer customerId , Integer beginIndex, Integer pageSize) {
		return contactDAO.getContactsByCustomerId(customerId , beginIndex ,pageSize);
	}

	public Integer getRecordCountByCustomerId(Integer customerId) {
		return contactDAO.getRecordCountByCustomerId(customerId);
	}
}
